package com.thunder.kocho.loki.shape;

import android.animation.Animator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;

import com.thunder.kocho.loki.ShapeLoki;

public class DropLoki extends ShapeLoki {

    private Path mPath;
    private float mLength;
    private float mLeft;
    private float mTop;

    public DropLoki(){}

    public DropLoki(float length,float mLeft,float mTop){
        this.mLength =length;
        this.mLeft=mLeft;
        this.mTop =mTop;
        initPath();
    }

    public void setLength(float mLength) {
        this.mLength = mLength;
        initPath();
    }

    public void setLeft(float mLeft) {
        this.mLeft = mLeft;
    }

    public void setTop(float mTop) {
        this.mTop = mTop;
    }

    @Override
    protected void drawShape(Canvas canvas, Paint paint) {
        if(getLokiBounds()!=null){
            paint.setStrokeJoin(Paint.Join.ROUND);
            paint.setStyle(Paint.Style.FILL);
            canvas.drawPath(mPath,paint);
        }
    }

    private void initPath(){
        mPath=new Path();
        mPath.moveTo(mLeft+mLength*0.5f,mTop+mLength);
        mPath.cubicTo(mLeft,mTop+mLength*0.4f,mLeft+mLength,mTop+mLength*0.4f,mLeft+mLength*0.5f,mTop+mLength);
        mPath.close();
    }


    @Override
    protected Animator onCreateAnimator() {
        return null;
    }

    @Override
    protected void reset() {
        resetAll();
    }
}
